FROM openjdk:8-jre-slim

MAINTAINER xiongjunfeng@haocang.com

ENV TSDB_VER=2.4.0 \
    TZ=Asia/Shanghai

COPY sources.list.debian /etc/apt/sources.list

RUN cp /usr/share/zoneinfo/${TZ} /etc/localtime \
  && apt-get update; apt-get install --no-install-recommends -y gnuplot-nox curl procps net-tools netcat gosu \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*

# RUN curl -O https://github.com/OpenTSDB/opentsdb/releases/download/v${TSDB_VER}/opentsdb-${TSDB_VER}_all.deb \
RUN useradd -md /home/opentsdb opentsdb \
  && curl -O http://sh.hc-yun.com:32050/data/opentsdb-${TSDB_VER}_all.deb \
  && dpkg -i opentsdb-${TSDB_VER}_all.deb \
  && rm -rf opentsdb-${TSDB_VER}_all.deb

ADD wait /wait
ADD start-tsdb.sh /start-tsdb.sh
ADD logback.xml /etc/opentsdb/logback.xml
ADD opentsdb.conf /etc/opentsdb/opentsdb.conf

EXPOSE 14242

CMD ["/start-tsdb.sh"] 
